package com.smart.test.proxy;

/**
 * @auther a123
 * @create 2018-08-14 17:47
 * @desc 监听逻辑类
 */
public class PerformanceMonitor {

    private static ThreadLocal<MethodPreformace> methodPerformnaceThreadLocal = new ThreadLocal<MethodPreformace>();

    public static void begin(String method){
        System.out.println("begin monitor ...");
        MethodPreformace methodPreformace = new MethodPreformace(method);
        methodPerformnaceThreadLocal.set(methodPreformace);
    }

    public static void end(){
        System.out.println("end monitor ...");
        MethodPreformace methodPreformace = methodPerformnaceThreadLocal.get();

        methodPreformace.printPreformance();
    }
}
